package com.kael.sgs.core.entity;

import java.util.HashSet;
import java.util.Set;

import com.kael.sgs.core.Connection;
import com.kael.sgs.core.ConnectionListener;

public abstract class ServerEntity implements ConnectionListener {
	protected final Set<Connection> connections = new HashSet<Connection>();
	
	/**
	 * Receive a connection from another source<br><br>
	 * 
	 * <strong>IMPORTANT</strong>: Remember to also {@linkplain Connection#setConnectionListener(ConnectionListener)}
	 * 
	 * @param connection : connection received
	 * @return true on success, false on failure
	 */
	public abstract boolean onReceivedConnection(Connection connection);
	
	/**
	 * Connection left this entity.
	 * 
	 * @param connection : connection left
	 */
	public abstract void onConnectionLeft(Connection connection);

	

}